package com.nyist.util;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class TransDate {

	public static Date strToDate(String str) {
		DateFormat format1 = null;
		Date date = null;
		if (str.contains("-")) {
			format1 = new SimpleDateFormat("yyyy-MM-dd");
		} else {
			format1 = new SimpleDateFormat("yyyy/MM/dd");
		}
		try {
			date = format1.parse(str);
		} catch (ParseException e) {
			e.printStackTrace();
		}
		return date;
	}
	
	
}
